package com.x.scratch.util;

import com.github.wxpay.sdk.WXPayConfig;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class ScratchWxPayConfig implements WXPayConfig {

    private byte[] certData;

    public ScratchWxPayConfig() throws Exception {
        File file = new File(Constant.WX_PAY_CERT_PATH);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();
    }

    public String getAppID() {
        return Constant.WX_APP_ID;
    }

    public String getMchID() {
        return Constant.WX_MCHID;
    }

    public String getKey() {
        return Constant.WX_KEY;
    }

    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    public int getHttpConnectTimeoutMs() {
        return 2000;
    }

    public int getHttpReadTimeoutMs() {
        return 10000;
    }

//    public String getNotifUrl() {
//        return "微信通知回调的url接口";
//    }

//    public String getTradeType() {
//        return "NATIVE";
//    }

//    public String getSpbillCreateIp() {
//        return "192.168.1.1";
//    }

//      IWXPayDomain getWXPayDomain() {
//          return WXPayDomainSimpleImpl.instance();
//      }

//    public String getPrimaryDomain() {
//        return "api.mch.weixin.qq.com";
//    }

//    public String getAlternateDomain() {
//        return "api2.mch.weixin.qq.com";
//    }

//    public int getReportWorkerNum() {
//        return 1;
//    }

//    public int getReportBatchSize() {
//        return 2;
//    }

}
